import os

from celery import Celery
from celery.schedules import crontab
from django.conf import settings

os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'jiaozi.settings')

app = Celery('magic_v3', broker=settings.CELERY_REDIS_BROKER, include=[])

app.config_from_object('django.conf:settings')

app.autodiscover_tasks(lambda: settings.INSTALLED_APPS)


app.conf.update(
    CELERYBEAT_SCHEDULE={
        "remind_user_buy_2m": {
            "task": 'vip.tasks.remind_user_buy_2m',
            "schedule": crontab(day_of_week=4, hour=17, minute=0),
            "args": ()
        },
    }
)
